<?php
namespace Admin\Controller;
use Think\Controller;
class SearchCheckController extends Controller {
    public function searchCheck(){
        
        //var_dump(session("username"));exit();
        isMyCookie();
        isLogin();
        
        $type=$_GET['type'];
        $checkstate= $_GET['checkstate'];
        
        $Info=D("Home/Info");
        $field=$Info->getInfoField();
        
        $map['type']=array('eq',$type);
        $state['checkstate']=array('eq',$checkstate);
        
        if($checkstate==1||$checkstate==0){
            $count = $Info->where($map)->where($state)->count();
        }else {
            $count = $Info->where($map)->count();
        }
        
        $Page=getMyPage($count,10);
        $show       = $Page->show();
        
        if($checkstate==1||$checkstate==0){
            $list  = $Info->field($field)->where($map)->where($state)->order('edate desc')->limit($Page->firstRow.','.$Page->listRows)->select();
        }else {
            $list  = $Info->field($field)->where($map)->order('edate desc')->limit($Page->firstRow.','.$Page->listRows)->select();
        }
        
        $this->assign("list", $list);
        $this->assign("page", $show);
        //var_dump($list);exit();
        
            
            if (count($list)>0){
               $this->display("Admin/admin");
            }else{
                $this->assign("msg","对不起没有查询到您要的信息!!!");
                $this->display("Admin/msg");
            }
    }
}